namespace mrs;

/// <summary>
/// API 响应
/// </summary>
/// <typeparam name="T"></typeparam>
public class ApiResponse<T>
{
    public T? Data { get; set; }
    public bool IsSuccess { get; set; }
    public string Message { get; set; }
    public DateTime Timestamp { get; set; }

    public static ApiResponse<T> Success(T data, string message = "操作成功")
    {
        return new ApiResponse<T>
        {
            Data = data,
            IsSuccess = true,
            Message = message,
            Timestamp = DateTime.UtcNow
        };
    }

    public static ApiResponse<object> Error(string message)
    {
        return new ApiResponse<object>
        {
            Data = null,
            IsSuccess = false,
            Message = message,
            Timestamp = DateTime.UtcNow
        };
    }

    // 
}